package ModelLayer;
import java.util.ArrayList;

public class DVD
{
    private long _id;
    private String _title;
    private String _director;
    private String _releaseDate;
    private ArrayList<Copy> _copies;
    private Copy _c;

    
    public DVD(long id, String title, String director, String releaseDate)
    {
        _id = id;
        _title = title; 
        _director = director;
        _releaseDate = releaseDate;
        _copies = new ArrayList<Copy>();
    }

    public void setID(long id)
    {
        _id = id;
    }
    
    public long getID()
    {
       return _id;
    }
    
    
    public void setTitle(String title)
    {
        _title = title;
    }
    
    public String getTitle()
    {
        return _title;
    }

   
    public void setDirector(String director)
    {
        _director = director;
    }
    
    public String getDirector()
    {
        return _title;
    }
    
    public void setReleaseDate(String releaseDate)
    {
        _releaseDate = releaseDate;
    }
    
    public String getReleaseDate()
    {
        return _releaseDate;
    }
    
    public void addCopy(Copy c)
    {
        _copies.add(c);
    }
    
    public ArrayList<String> getCopySerial()
    {
        ArrayList<String> serials = new ArrayList<String>();
        
        for (Copy c : _copies)
        {
            serials.add(c.getSerialNr());
        }
        
        return serials;
    }
    
    public String listAllCopies()
    {
        String copies = "";
        
        for (Copy c : _copies)
        {
            copies += "     Serial number: " + c.getSerialNr() + "\n";
            copies += "     Obtain date: " + c.getObtainDate() + "\n";
            copies += "     Obtain price: " + c.getObtainPrice() + "\n\n";
        }
        
        return copies;
    }
    
    public ArrayList<Copy> getAllCopies()
    {
        return _copies;
    }
    
    public Copy getCopyBySerial(String serialNr)
    {
        
        for (Copy c : _copies)
        {
            if (c.getSerialNr() == serialNr)
                _c = c;
        }
        
        return _c;
    }
}


